package cn.me.alphamq.common.enumeration;

/**
 * broker 的集群模式的枚举类
 *
 * @author f
 */
public enum BrokerModeEnum {
    STANDALONE("standalone"),
    MASTER_SLAVE("master-slave");

    // 根据枚举的 code 属性获取枚举
    public static BrokerModeEnum of(String code) {
        for (BrokerModeEnum type : BrokerModeEnum.values()) {
            if (type.code.equals(code)) {
                return type;
            }
        }
        throw new RuntimeException("invalid broker mode code: " + code);
    }

    private final String code;

    BrokerModeEnum(String code) {
        this.code = code;
    }

    public String getCode() {
        return code;
    }
}
